#define _CRT_SECURE_NO_WARNINGS

#include <stdio.h>
#include <string.h>
struct LD
{
	char name[10];
	int count;

}leader[3] = { {"zhangsan",0},{"lisi",0},{"wangwu",0} };
int main()
{
	int n = 10;
	scanf("%d", &n);
	getchar();

	for (int i = 1; i <= n; i++)
	{
		char sel_name[10];
		gets_s(sel_name);

		for (int j = 0; j < n; j++)
		{
			if (strcmp(leader[j].name, sel_name) == 0)
				leader[j].count++;
		}
	}
	for (int i = 0; i < 3; i++)
	{
		printf("%11s %3d\n", leader[i].name, leader[i].count);
	}
	return 0;
}